import { Cascader } from 'ant-design-vue'
import { defineComponent, PropType, ref, watch } from 'vue'
import cities from './_city.json'

export default defineComponent({
  name: 'SpsAreaSelect',
  props: {
    value: {
      type: Array as PropType<string[]>
    }
  },
  emits: ['update:value'],
  setup(props, { attrs, emit }) {
    const model = ref(props.value)
    watch(model, (val) => {
      emit('update:value', val)
    })
    /* render 函数 */
    return () => {
      return (
        <Cascader v-model:value={model.value} options={cities} {...attrs} />
      )
    }
  }
})
